public class Animal {
String name;
int age;
public Animal(String name, int age){
this.name = name;
this.age = age;
}
public void eat(){
System.out.println(name + "吃饭");
}
}
 class Cat extends Animal{
public Cat(String name, int age){
super(name, age);
}
@Override
public void eat(){
System.out.println(name+"吃鱼~~~");
}
}
 class Dog extends Animal {
public Dog(String name, int age){
super(name, age);
}
@Override
public void eat(){
System.out.println(name+"吃骨头~~~");
}

 /* public static void main(String[] args) {
      Animal animal2= new Cat("小七",5);
      animal2.name="小七";
      animal2.age = 5;
      animal2.eat();
      System.out.println("-------------------------");

    Animal animal1= new Dog("小八",3);
      animal1.name="小八";
      animal1.age = 3;
      animal1.eat();
      System.out.println("--------------------------------");

   Animal animal = new Animal("小七",5);
   animal.name="小七";
   animal.age = 5;
   animal.eat();
  }*/
}
